{assign_variable:this_weblog="working_here"}
{assign_variable:this_template_group="working-here"}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb">
<head>
     <title>NCE Intranet</title>
     <script language="javascript" src="/_includes/AC_ActiveX.js" type="text/javascript"></script>
     <script language="javascript" src="/_includes/AC_RunActiveContent.js" type="text/javascript"></script>
     <link rel="stylesheet" href="/_styles/global.css" media="screen,projection" type="text/css" />
     <link rel="stylesheet" href="/_styles/navigation.css" media="screen,projection" type="text/css" />
     <link rel="stylesheet" href="/_styles/meeting-rooms.css" media="screen,projection" type="text/css" />
     {embed=_includes/tracewatch}

<?php
	if (empty($_REQUEST['room_id'])) { // if no room id is provided, switch to rooms view
		$url = "/working-here/meeting-rooms/?";
		
		foreach ($_GET as $key => $value){
			if ($key != 'action')
				$url .= $key . "=" . urlencode($value) . "&";
		}
	
$js = <<<END_JS
		<script language="javascript">
			document.location = '$url';
		</script>
END_JS;
		echo $js;
	}
?>
</head>

<body id="{segment_1}" class="sub cat-67">
     <div id="left"></div>
     <div id="right"></div>
     <div id="centre">
          <div id="centre-top">
               <div id="compact-top-nav">
                    {embed=_includes/topnav}
               </div>
               <div id="user-links">
			        {if logged_in}
                         {embed=_components/userlinks}
                    {if:else}
                         {embed=_components/userlinks2}
                    {/if}
               </div>
               <div id="searchbox">{embed=_components/search}</div>
          </div> <!-- end centre-top -->
    
          <div id="section-centre-mid">
               <div id="section-title">
                    <a href="/working-here/" id="section-title-link"><span>Working Here</span></a>
               </div>
          </div>

          <div id="centre-body">
               <div id="content-panel">
                    <div id="wide-entries">
                         <div id="breadcrumb">
						      <a href="/">{embed=_language/intranet}</a> &gt; <a href="/working-here/">Working Here</a> &gt; <a href="/working-here/category/list/Office%20Facilities/">Office Facilities</a> &gt; <a href="/working-here/meeting-rooms/">Meeting Rooms</a>
                         </div>
                         {exp:weblog}{/exp:weblog}

                         {exp:ncb_rooms:calendar switch="calendarToday|calendarCell" booking_script_url="/working-here/book-room/" booking_submit_url="/working-here/book-room-submit/" show_rooms_list="no" action="day_view"}

                              {messages}
                                   <div id="messages" class="booking-panel" style="margin-top: 40px;">
                                        <div class="booking-container">
		                                   <p>{message}</p>
		                                   <p><a title="back to previous page" href="{previous_url}">Go Back</a></p>
                                        </div>
                                   </div> <!-- end booking panel -->
                              {/messages}

                              {day_view}
                                   <br/>
                                   <div id="room-details">
                                        <h3>
                                             <span style="background-color: {hex_colour}; display: inline; border: solid 1px #000; width: 16px; height: 16px; margin-right: 2px;">&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                             <span id="room-name">{room_name} - {extension}</span>
                                             <span id="room-location">{room_location}</span>
                                             <span id="room-description">{room_description}</span>
                                        </h3>
                                   </div>
                                   <div id="booking-list">
                                        <div id="nav-links">
                                             <table width="100%" cellspacing="0" cellpadding="0">
                                                  <tr>
                                                       <td width="30%" align="left">
                                                            &nbsp;
                                                            <span class="prevnext-link">
                                                                 {previous_day_link title="previous day"}&lt; Previous Day{/previous_day_link}&nbsp;
                                                            </span>
                                                       </td> <!-- previous only shown if not in the past -->
                                                       <td width="40%" align="center">
															<nobr>
																<span class="date-nav">
																	Available dates:
																	{available_dates_list}
																		<select name="booking_date" onChange="window.location='{on_change_url}'+this.options[this.selectedIndex].value">
																			{date_info}
																				<option value="{internal_date}" {if booking_date}selected{/if} >{display_date}</option>
																			{/date_info}
																		</select>
																	{/available_dates_list}
																</span>
																&nbsp;
																<a href="/working-here/meeting-rooms?action=rooms_view&amp;booking_date={booking_date_value}" 
		                                                             title="go to rooms view for {booking_date}">rooms view</a>
															</nobr>
	                                                       </td>
                                                       <td width="30%" align="right">
                                                            <span class="prevnext-link">{next_day_link title="next day"}Next Day &gt;{/next_day_link}</span>
                                                            &nbsp;
                                                       </td> <!-- next shown only if before last advance booking date -->
                                                  </tr>
                                             </table>
                                        </div> <!-- end nav-links -->

                                        <div style="clear: both">&nbsp;</div>

                                        <div id="mini-room-data">
                                             <div id="mini-booking-list">
                                                  {bookings}
                                                       <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                            {booking_slot}
                                                                 {if slot_booked}
                                                                      <tr class="mini-booked" style="background-color: #FFF">
                                                                           <td class="slot-time">
                                                                                {if current_slot}<strong>{/if}
                                                                                {slot_time}
                                                                                {if current_slot}</strong>{/if}
                                                                           </td>
                                                                           {if single_slot}
                                                                                <td class="booking-col" rowspan="{slot_count}">
                                                                                     <span class="booking-slot"> 
                                                                                          <span class="mini-event-title">
                                                                                               <a href="#" onClick="alert(this.title); return false;" 
                                                                                                    title="{meeting_name} ({booking_time}) booked by {booking_owner} ({booking_owner_email})">
                                                                                                    {char_limit limit="15"}{meeting_name}{/char_limit}
                                                                                               </a>
                                                                                          </span>
                                                                                     </span>
                                                                                </td>
                                                                           {/if}
                                                                           {if booking_start}
                                                                                <td class="booking-col" rowspan="{slot_count}">
                                                                                     <span class="mini-event-title">
                                                                                          <a href="#" onClick="alert(this.title); return false;" 
                                                                                               title="{meeting_name} ({booking_time}) booked by {booking_owner} ({booking_owner_email})">
                                                                                               {char_limit limit="15"}{meeting_name}{/char_limit}
                                                                                          </a>
                                                                                     </span>
                                                                                </td>
                                                                           {/if}
                                                                           <td class="mini-cancel-col" rowspan="{slot_count}">
                                                                                <div class="cancel-link">
                                                                                     <!-- cancel link only shown if booking belongs to you or logged in as a super-admin -->
                                                                                     {cancel_link title="Cancel this booking"}
                                                                                          <img src="/images/meetingrooms/cancel.png" alt="cancel booking" width="12" height="12" />
                                                                                     {/cancel_link}  
                                                                                </div>
																				<div class="end-link">
																					 <!-- end link only shown if booking belongs to you or logged in as a super-admin -->
																					 {end_link title="End this booking now"}
                                                                                          <img src="/images/meetingrooms/end_booking.png" alt="end booking" width="12" height="12" />
																					 {/end_link}  
																				</div>	
                                                                           </td>
                                                                      </tr>
                                                                 {/if}
                                                                 {if not_slot_booked}
                                                                      <tr class="not-booked {if next_slot_booked}booking-follows{/if}">
                                                                           <td class="slot-time" width="20">
                                                                                {if current_slot}<strong>{/if}{slot_time}{if current_slot}</strong>{/if}
                                                                           </td>
                                                                           <td class="booking-col {if slot_in_past}slot-past{/if}" colspan="2">									
                                                                                {if slot_in_past}&nbsp;{/if}
                                                                                {if not_slot_in_past}
                                                                                     <a class="mini-day-booking-link" href="{booking_script_url}" 
                                                                                          title="Set {slot_time} as start time in the booking form">
                                                                                          Book This
                                                                                     </a>
                                                                                {/if}
                                                                           </td>
                                                                      </tr>
                                                                 {/if}
                                                            {/booking_slot}
                                                       </table>
                                                  {/bookings}
                                             </div> <!-- end mini-room-data -->
                                        </div> <!-- end mini-booking-list -->

                                        {booking_form}
                                             <div id="booking-form">
                                                  <div style="float: left; padding-left: 15px">
                                                       <h3>Book a Meeting</h3>
                                                       <p>Please click on a free booking slot from the list, select a duration for your meeting and click 'Book room'.</p>
                                                  </div>
                                                  <div id="mini-room-booking" class="mini-booking-panel">
                                                       <div class="booking-container">
                                                            {errors}
                                                            <p>Booking on: <strong>{booking_date}</strong></p>
                                                            <table width="100%" border="0" cellpadding="4" cellspacing="0">
                                                                 <tr class="form-meeting-name">
                                                                      <td>Meeting name:</td>
                                                                      <td>
                                                                           {field_meeting_name}<br />
                                                                           <span class="note">Give your meeting a name so that people can identify it.</span>
                                                                      </td>
                                                                 </tr>
                                                                 <tr class="form-start-time">
                                                                      <td>Start time:</td>
                                                                      <td>{field_start_time_hours} : {field_start_time_minutes}</td>
                                                                 </tr>
                                                                 <tr class="form-duration">
                                                                      <td>Duration:</td>
                                                                      <td>{field_duration_minutes} </td>
                                                                 </tr>
                                                                 <tr class="form-room">
                                                                      <td>Room:</td>
                                                                      <td>
                                                                           {field_room} <br/>
                                                                           <span class="note">Changing the room will reset this form and show related bookings for the room.</span>
                                                                      </td>
                                                                 </tr>
                                                                 <tr>
                                                                      <td>Booking owner: </td>
                                                                      <td>{booking_owner} </td>
                                                                 </tr>
                                                                 <tr>
                                                                      <td></td>
                                                                      <td>{field_submit_ok value="Book room" style="width: 80px"}</td>
                                                                 </tr>
                                                            </table>
                                                       </div>
                                                  </div> <!-- end booking panel -->
                                             </div> <!-- end booking_form -->
                                        {/booking_form}
                                        <div style="clear: both">&nbsp;</div>
                                   </div> <!-- end booking-list -->
                              {/day_view}
                         {/exp:ncb_rooms:calendar}
                    </div> <!-- end wide-entries -->
               </div> <!-- end content panel -->
          </div> <!-- end centre body -->
          <div id="centre-footer">&nbsp;</div>
     </div> <!-- end centre -->
</body>
</html>